var mysql =require('mysql');

//创建连接
var conn=mysql.createConnection({
	host:"localhost",
	user:"root",
	password:"root",
	database:"zm@2018"
});
//打开连接
conn.connect();
//执行数据操作
conn.query("select * from testuser",function(err,res,fields){
	if(err) throw error;
	console.log(res[0]);
});
//关闭连接
conn.end();